home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / jazlib.arc / JZINSINT.C < prev    next >
Text File  |  1988-12-18  |  1KB  |  39 lines

  1. /*
  2. ┌────────────────────────────────────────────────────────────────────────────┐
  3. │jzinsint.c                                     │
  4. │Install an interrupt into the assembler routine jzinthnd.c             │
  5. │You must declare the ffunction argument as global in the main routine:      │
  6. │int inthandler();                                 │
  7. │main()                                      │
  8. │{                                         │
  9. │   jzinsint(5,inthandler);    ( steals the print screen interrupt )         │
  10. │}                                         │
  11. │                                         │
  12. │int inthandler()                                 │
  13. │{                                         │
  14. │  jzscrprn("inside the interrupt handler",24,0,31);                         │
  15. │}                                         │
  16. │                                         │
  17. │ (C) JazSoft Software by Jack A. Zucker (301) 794-5950              │
  18. └────────────────────────────────────────────────────────────────────────────┘
  19. */
  20.  
  21.  
  22. #include <jaz.h>            /* define macros and types */
  23. extern int jzinthnd();            /* asm interrupt handler */
  24. extern int far gdseg,gfunction;     /* public vars defined in jzinthnd.asm*/
  25.  
  26. jzinsint(fintnum,ffunction)
  27. int fintnum;
  28. int (*ffunction)();
  29. {
  30.   TVECTOR wvec;
  31.   wvec.segment = getcs();        /* get code segment */
  32.   wvec.offset = (int) jzinthnd;     /* point to asm routine */
  33.   gdseg = getds();            /* save data segment for int handler */
  34.   gfunction = (int) ffunction;        /* set variable for call [bx] */
  35.   cli();                /* don't allow interrupts */
  36.   jzsetint(fintnum,wvec);        /* call dos to set interrupt */
  37.   sti();                /* turn interrupts back on */
  38. }
  39.